/**
 * 
 */
package jvs.sh;

import java.io.OutputStream;
import java.io.PrintStream;


/**
 * @author qiangli
 * 
 */
public abstract class BasicConsole implements Console {
	protected PrintStream err = System.err;
	protected PrintStream out = System.out;
	protected PrintStream log = System.err;
	protected String logTag = "log: ";
	protected String outTag = "--- ";
	protected String okTag = "200 ";
	protected String errTag = "500 ";
	
	public BasicConsole() {
	}
	
	public void log(String s) {
		err.print(logTag + s);
	}

	public void status(String code, String s) {
		out.print(code+" "+s);
	}

	public void err(String s) {
		out.print(errTag + s);
	}

	public void ok(String s) {
		out.print(okTag + s );
	}

	public void out(String s) {
		out.print(outTag + s);
	}

	public void flush() {
		out.flush();
		err.flush();
	}

	public OutputStream data() {
		return out;
	}

}
